﻿using DevExpress.Utils;
using DevExpress.XtraEditors.Repository;
using DevTeam;

using System;
using System.Drawing;
using System.Windows.Forms;

namespace ConfExpert.Forms.Depo.Aksesuar
{
    public partial class Sec : XPopupForm
    {
        string Akslist;
        public Sec(string akslist)
        {
            InitializeComponent();
            Akslist = akslist;
        }

        BindingSource bs;
        private void Sec_Load(object sender, EventArgs e)
        {
            

            bs =new BindingSource(ds, "AksesuarPhotos");
            GetDetails("AksesuarPhotos", "GetAksesuarResimleri", Akslist);
            InitGridView(gvAksResim, bs);
            gvAksResim.Columns["Photo1"].VisibleIndex = 0;
            gvAksResim.Columns["Photo1"].ColumnEdit = new RepositoryItemPictureEdit();
            gvAksResim.MakeColumnInvisible("Photo2", "Photo1fs", "Photo2fs", "AksesuarGUID");
            gvAksResim.MakeReadOnly();
            gvAksResim.RowCellStyle += new DevExpress.XtraGrid.Views.Grid.RowCellStyleEventHandler(gvAksResim_RowCellStyle);
            gvAksResim.DoubleClick += new EventHandler(gvAksResim_DoubleClick);
            gvAksResim.BestFitColumns();
        }

        void gvAksResim_RowCellStyle(object sender, DevExpress.XtraGrid.Views.Grid.RowCellStyleEventArgs e)
        {
            if (e.RowHandle > -1)
                if (e.Column.FieldName == "AksesuarId")
                    e.Appearance.Font = new Font(AppearanceObject.DefaultFont, FontStyle.Bold);
        }

        public int AksesuarId = 0;
        void gvAksResim_DoubleClick(object sender, EventArgs e)
        {
            AksesuarId = intParse(bs, "AksesuarId");
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
    }
}